﻿using Serilog;
using Topshelf;

namespace Sustainalytics.Replication.Service
{
    class Program
    {
        static void Main(string[] args)
        {
            HostFactory.Run(x =>
            {
                x.Service<ServiceBusHandler>(sc =>
                {
                    sc.ConstructUsing(() => new ServiceBusHandler());
                    sc.WhenStarted(s => s.Start());
                    sc.WhenStopped(s => s.Stop());
                });

                x.RunAsLocalSystem();

              
               Log.Logger = new LoggerConfiguration()
                        .Enrich.WithProcessName()
                        .Enrich.WithMachineName()
                        .Enrich.FromLogContext()
                        .ReadFrom.AppSettings()
                        .CreateLogger();
                
            });
        }
    }
}
